package myAsm;

import java.util.Map;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Transient;

import org.objectweb.asm.MethodVisitor;


@Entity
@DiscriminatorValue("INSN_INTINSN")
public class MyIntInsnNode extends MyAbstractInsnNode {
	 /**
     * The operand of this instruction.
     */
	@Transient
    public int operand;

    public MyIntInsnNode() {
        super(-1);
    }
	
    /**
     * Constructs a new {@link IntInsnNode}.
     * 
     * @param opcode the opcode of the instruction to be constructed. This
     *        opcode must be BIPUSH, SIPUSH or NEWARRAY.
     * @param operand the operand of the instruction to be constructed.
     */
    public MyIntInsnNode(final int opcode, final int operand) {
        super(opcode);
        this.operand = operand;
    }

    /**
     * Sets the opcode of this instruction.
     * 
     * @param opcode the new instruction opcode. This opcode must be BIPUSH,
     *        SIPUSH or NEWARRAY.
     */
    public void setOpcode(final int opcode) {
        this.opcode = opcode;
    }

    public int getType() {
        return INT_INSN;
    }

    public void accept(final MethodVisitor mv) {
        mv.visitIntInsn(opcode, operand);
    }

    public MyAbstractInsnNode clone(final Map labels) {
        return new MyIntInsnNode(opcode, operand);
    }
}
